package com.ojoin.trade.t0loan_core.web.service;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.common.web.service.BaseService;
import com.ojoin.trade.t0loan_core.web.domain.TbT0LoanFinalApplication;
import com.ojoin.trade.t0loan_core.web.domain.TbT0RefundTaskVO;

/**
 * T+0贷款基础服务接口
 * @author guoting
 *
 */
public interface T0LoanBaseService extends BaseService<TbT0LoanFinalApplication> {
	
	/**
	 *  T* 放款审核
	 * 
	 * 说明：
		1)、调用新增T+0贷款业务账户变更操作日志记录(T0000011)接口，状态为未放款
		2)、调用新建九盈T+0贷款记录与pos机交易记录对照表记录(T0000012)接口
		3)、调用新建九盈T+0贷款记录包含的pos机交易记录状态表记录(T0000013)接口，状态为未放款未还款
		以上步骤一个事务中执行
	 * @throws BusinessException
	 */
	public void updateCreditApprove(int operatorid, int companyid, int joinuserid, String transdate, String operatetype, String realcreditamount) throws BusinessException;
		
	/**
	 * T* 放款
	 * @param loanlogid
	 * 
	 * 说明：
		1)、更新T+0贷款业务账户变更操作日志的放款状态为已放款
		3)、更新九盈T+0贷款记录包含的pos机交易记录状态表记录(T0000013)接口，放款状态为已放款
		4)、调用转账(JA000016)接口，从保理公司的支付账户id扣除放款金额，并为商户的支付账户id增加放款金额
		以上步骤一个事务中执行
	 * 
	 * @throws BusinessException
	 */
	public void updateCreditLoan(Integer loanlogid, String operatetype, String paypwd, String pagets) throws BusinessException;
	
	/**
	 * T* 放款任务(重做任务，更新数据)
	 * @param loanlogid
	 * @param orderid
	 * @throws BusinessException
	 */
	public void updateCreditLoanRedo(int loanlogid, String operatetype, String paypwd, String orderid) throws BusinessException;
	
	
	/**
	 * 生成T*还款任务
	 * @param operate_type
	 * @throws BusinessException
	 */
	public void updateGenRefundTask() throws BusinessException;
	
	public void testRunRefundTask() throws BusinessException;
	/**
	 * 执行T*还款任务
	 * @param operate_type
	 * @throws BusinessException
	 */
	public void execRunRefundTask() throws BusinessException;
	
	/**
	 * 每个商户执行T*还款任务
	 * @param refundtaskvo
	 * @throws BusinessException
	 */
	public String updateRunEachRefundTask(TbT0RefundTaskVO refundtaskvo) throws BusinessException;
	
	/**
	 * 每个商户执行T*还款任务(重做任务，更新数据)
	 * @param refundtaskvo
	 * @throws BusinessException
	 */
	public void updateRunEachRefundRedoTask(TbT0RefundTaskVO refundtaskvo, String orderid) throws BusinessException;


}
